home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGBLER / WHIZZARD.LZH / CLREOL.ASM < prev    next >
Assembly Source File  |  1983-06-27  |  3KB  |  107 lines

  1. COMMENT *
  2.  
  3.                  CLUBware  (tm)
  4.  
  5.       CLREOL clears the screen from the current position to the end
  6.           of the current line.    Cursor is left at starting
  7.           position.
  8.  
  9.            Copyright 1984 Rayhawk Automation N.W. Inc
  10.                   P.O. Box 1427
  11.                   Beaverton, Oregon   97075
  12.  
  13.       Algorithm:
  14.           1) determine current position
  15.           2) determine number of blanks required
  16.           3) write that many blanks using INT 10, AH=9
  17.  
  18.  
  19.       CALL    CLREOL ( FLAG% )
  20.  
  21.           FLAG%       environment flag
  22.                   = 0 means under basic interpreter
  23.                   = 1 means under compiled basic
  24.                   = 2 means under compiled business basic
  25.  
  26.                                           *
  27.  
  28. ;______________________________________________________________________________
  29.  
  30. ;  Normal assembly directives
  31.  
  32. CODE      SEGMENT PARA PUBLIC 'CODE'
  33.  
  34.       ASSUME  CS:CODE
  35.  
  36.       PUBLIC  CLREOL
  37.  
  38. ENV_FLAG      EQU  WORD PTR [BP+6] ; address of environment flag on stack
  39.  
  40.  
  41. ;______________________________________________________________________________
  42.  
  43. CLREOL      PROC      FAR
  44.  
  45.       PUSH      AX               ; save all registers used,
  46.       PUSH      BX               ;  no data segment local to this
  47.       PUSH      CX               ;  routine so segment registers
  48.       PUSH      DX               ;  are untouched.
  49.       PUSH      ES
  50.  
  51.  
  52. ;      ...      0) load environment flag showing compiled or interpreted
  53.  
  54.       MOV      BX,ENV_FLAG           ; load address of environment flag
  55.  
  56.  
  57. ;      ...      1) load current position from 0000:0450 if compiled
  58. ;              or from DS:[0056h] if interpreted
  59.  
  60.       SUB      AX,AX            ; address system memory
  61.       MOV      ES,AX
  62.  
  63.       CMP      WORD PTR DS:[BX],0       ; check environment flag
  64.       JNE      COMPILED
  65.  
  66.       MOV      DX,WORD PTR DS:[0056h]   ; load from basic space
  67.       XCHG      DL,DH            ; basic has it reversed
  68.       DEC      DL               ; basic starts count from 1
  69.       DEC      DH               ;  instead of zero
  70.       JMP      SHORT HAVE_POSITION
  71.  
  72. COMPILED:
  73.       MOV      DX,WORD PTR ES:[450h]    ; load current position
  74.                        ;  from system space
  75. HAVE_POSITION:
  76.  
  77. ;      ...      2) determine number of blanks required
  78.  
  79.       MOV      CX,80            ; first column on line is 0
  80.       SUB      CL,DL            ; subtract off current column
  81.       JZ      AT_END_OF_LINE       ; if zero, then already at end
  82.  
  83.  
  84. ;      ...      3) write that many blanks using INT 10, AH=9
  85.  
  86.       MOV      AX,0A20h           ; AH = 10  and  AL = blank
  87.       MOV      BX,0000h           ; BH = 0 (assume always on page 0
  88.                        ; use existing attribute
  89.       INT      10h               ; write that many blanks
  90.  
  91. AT_END_OF_LINE:
  92.       POP      ES
  93.       POP      DX
  94.       POP      CX
  95.       POP      BX
  96.       POP      AX
  97.       RET      2
  98.  
  99.  
  100. CLREOL      ENDP
  101.  
  102. ;______________________________________________________________________________
  103.  
  104. CODE      ENDS
  105.  
  106.       END
  107.